﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ERP.Manager.DataProvider;
using ERP.Manager.DataEntity;

namespace ERP.Manager.BusinessServices
{
    public class WorkinfoServices
    {
        private readonly IWorkRepository workRepository;

        public WorkinfoServices() { }
        public WorkinfoServices(IWorkRepository workrepository)
        {
            this.workRepository = workrepository;
        }

        #region 查询所有发布信息的方法
        public List<WorkInfo> getWorks()
        {
            return workRepository.getWorks();
        }
        #endregion

        #region 根据用户编号查询当前用户发布的消息信息的方法
        public List<WorkInfo> getWorksByToUserId(string UserId)
        {
            return workRepository.getWorksByToUserId(UserId);
        }
        #endregion

        #region 根据用户编号查询当前用户发布消息信息的方法
        public List<WorkInfo> getWorksByFromUserId(string fromuserid, int pagecount)
        {
            return workRepository.getWorksByFromUserId(fromuserid, pagecount);
        }
        #endregion

        #region 根据发布消息编号查询发布消息的详细信息
        public WorkInfo getWorkById(int workId)
        {
            return workRepository.getWorkById(workId);
        }
        #endregion

        #region 添加发布消息的方法
        public int addWork(WorkInfo work)
        {

            return workRepository.addWork(work);
        }
        #endregion

        #region 修改发布消息的方法
        public int updateWork(WorkInfo work)
        {
            return workRepository.updateWork(work);
        }
        #endregion

        #region 删除发布信息的方法
        public int deleteWorkById(int workId)
        {
            return workRepository.deleteWorkById(workId);
        }
        #endregion

        #region 查询正在进行工作的信息的方法
        public List<WorkInfo> allworkinfojinxing(string userid, int pagecount)
        {
            return workRepository.allworkinfojinxing(userid, pagecount);
        }
        #endregion

        #region 查询正在进行中工作的信息
        public List<WorkInfo> allworkinfowancheng(string userid, int pagecount)
        {
            return workRepository.allworkinfowancheng(userid, pagecount);
        }
        #endregion

        #region 查询已超期工作任务的信息
        public List<WorkInfo> allworkinfochaoqi(string userid, int pagecount)
        {
            return workRepository.allworkinfochaoqi(userid, pagecount);
        }
        #endregion

        #region 查询自己当前接收任务的详细信息的方法
        public WorkInfo getworkinfobyuseriddetail(string userid, int workid)
        {
            return workRepository.getworkinfobyuseriddetail(userid, workid);
        }
        #endregion

        #region 查询自己当前发布任务的详细信息的方法
        public WorkInfo getworkinfobyreleaseworkdetail(string userid, int workid)
        {
            return workRepository.getworkinfobyreleaseworkdetail(userid, workid);
        }
        #endregion

        #region 修改状态值为5或者结束时间小于当前时间的方法
        public int updateworkinfostatus(string userid)
        {
            return workRepository.updateworkinfostatus(userid);
        }
        #endregion

        #region 修改工作任务的状态的方法
        public int updateworkstatus(WorkInfo workinfo)
        {
            return workRepository.updateworkstatus(workinfo);
        }
        #endregion

        #region 进行的工作修改为已完成然后添加完成任务的备注信息
        public int updateworkstatusandworkinfonote(WorkInfo work)
        {
            return workRepository.updateworkstatusandworkinfonote(work);
        }
        #endregion

        #region 分页显示自己当前接收的任务的方法
        public List<WorkInfo> getworkinfobyuseridpagecount(string userid, int pagecount)
        {
            return workRepository.getworkinfobyuseridpagecount(userid, pagecount);
        }
        #endregion

        #region 查询自己当前发布的任务所有的条数记录
        public int getworkinfobyreleaseworkcount(string fromuserid)
        {
            return workRepository.getworkinfobyreleaseworkcount(fromuserid);
        }
        #endregion     

        #region  查询正在进行工作记录的总条数
        public int allworkifojinxingcount(string touserid)
        {
            return workRepository.allworkifojinxingcount(touserid);
        }
        #endregion

        #region 查询已完成工作任务的信息的总条数
        public int allworkinfowanchengcount(string touserid)
        {
            return workRepository.allworkinfowanchengcount(touserid);
        }
        #endregion

        #region 查询已超期工作任务的信息的总条数的方法
        public int allworkinfochaoqicount(string touserid)
        {
            return workRepository.allworkinfochaoqicount(touserid);
        }
        #endregion

        #region 根据用户编号查询发布信息
        public List<WorkInfo> getallworkfromuserid(string fromuserid)
        {
            return workRepository.getallworkfromuserid(fromuserid);
        }
        #endregion

        #region 根据用户编号删除发布信息
        public int deleteworkfromuserid(string fromuserid)
        {
            return workRepository.deleteworkfromuserid(fromuserid);
        }
        #endregion
    }
}
